package alg.lcr;

import jade.core.Profile;
import jade.core.ProfileImpl;
import jade.core.Runtime;
import jade.wrapper.AgentController;
import jade.wrapper.ContainerController;

public class LeaderElectionController {

	public static void main(String[] args) {
		
		Runtime rt = Runtime.instance();
		Profile p = new ProfileImpl();
		ContainerController cc = rt.createMainContainer(p);
		try
		{
			AgentController v0;
			AgentController v1;
			AgentController v2;
			AgentController v3;
			AgentController v4;
			
			v0 = cc.createNewAgent("v0", "alg.lcr.Node", new String[] {"v4", "v1", "3"});
			v1 = cc.createNewAgent("v1", "alg.lcr.Node", new String[] {"v0", "v2", "2"});
			v2 = cc.createNewAgent("v2", "alg.lcr.Node", new String[] {"v1", "v3", "1"});
			v3 = cc.createNewAgent("v3", "alg.lcr.Node", new String[] {"v2", "v4", "5"});
			v4 = cc.createNewAgent("v4", "alg.lcr.Node", new String[] {"v3", "v0", "4"});
			
			v0.start();
			v1.start();
			v2.start();
			v3.start();
			v4.start();
			
		} catch (Exception e)
		{
			e.printStackTrace();
		}

	}

}
